package com.gw.vip.common.exception;

/**
 * @author GW
 * @description 服务端通用异常
 * @since 2022-03-30
 */
public class ServiceException extends RuntimeException {

    private String code;

    public ServiceException(String message){
        super(message);
        this.code = "500";
    }

    public ServiceException(String code, String message){
        super(message);
        this.code = code;
    }

    public ServiceException(ExceptionEnums exceptionEnums){
        super(exceptionEnums.getValue());
        this.code = exceptionEnums.getKey();
    }

    public ServiceException(ExceptionEnums exceptionEnums, String message){
        super(message);
        this.code = exceptionEnums.getKey();
    }

    public String getCode(){
        return this.code;
    }
}
